Use of FLAG in programming
Flag variable is used as a signal in programming to let the program know that a certain condition has met. It usually acts as a boolean variable indicating a condition to be either true or false. Example 1: Check if an array has any even number....
read more
C++ Program To Reverse Words In A Given String
Example: Let the input string be “i like this program very much”. The function should change the string to “much very program this like i”...
read more
Goldman Sachs Interview Experience | Campus drive for summer internship 2021 – IIT(BHU)
The process consisted of 1 online coding round , 3  tech interview rounds and 1 HR interview round....
read more
C/C++ program to implement CHECKSUM
The Checksum is an error detection method that detected errors in data/message while it is transmitted from sender to receiver. This method is used by the higher layer protocols and makes use of the Checksum Generator on the Sender side and Checksum Checker on the Receiver side....
read more
Array of Linked Lists in C/C++
An array in C/C++ or be it in any programming language is a collection of similar data items stored at contiguous memory locations and elements that can be accessed randomly using indices of an array.  They can be used to store the collection of primitive data types such as int, float, double, char, etc of any particular type. To add to it, an array in C/C++ can store derived data types such as structures, pointers, etc. Given below is the picture representation of an array....
read more
DFA accepting all strings over w ∈(a,b)* which contains “aba” as a substring
Given a binary string S, the task is to write a program for DFA Machine that accepts a set of all strings over w ∈ (a, b)* which contains “aba” as a substring.Examples :...
read more
C++ Program For Stock Buy Sell To Maximize Profit
The cost of a stock on each day is given in an array, find the max profit that you can make by buying and selling in those days. For example, if the given array is {100, 180, 260, 310, 40, 535, 695}, the maximum profit can earned by buying on day 0, selling on day 3. Again buy on day 4 and sell on day 6. If the given array of prices is sorted in decreasing order, then profit cannot be earned at all....
read more
Count of distinct permutations of every possible length of given string
Given a string S, the task is to count the distinct permutations of every possible length of the given string....
read more
Length of longest subarray whose sum is not divisible by integer K
Given an array arr[] of size N and an integer k, our task is to find the length of longest subarray whose sum of elements is not divisible by k. If no such subarray exists then return -1.Examples:...
read more
Number of stopping station problem
There are 12 intermediate stations between two places A and B. Find the number of ways in which a train can be made to stop at 4 of these intermediate stations so that no two stopping stations are consecutive?Examples –...
read more
Maximum length of subarray such that sum of the subarray is even
Given an array of N elements. The task is to find the length of the longest subarray such that sum of the subarray is even.Examples:...
read more
Bit Magic C/C++ Programs
Bit manipulation, also known as bit magic is the process of using bit-level operations to manipulate individual bits of a number. It uses bitwise operators such as AND, OR, XOR, right shift, etc. to manipulate, set, and shift the individual bits. This is used to improve the efficiency of our program and provide compact code....
read more